アニメーションソースを設定したり、戻したりします。FCurve、ShapeKey、またはStaticSourceを取得できますが、設定できるのは f
カーブまたはスタティックアニメーションソースのみです。新しいソースがヌルまたは無効なソースの場合は、無効な引数エラーが発生します。
注:AnimationSourceItem がコンパウンド(siAnimCompoundAnimItem または
siShapeCompoundAnimItem)の場合、このプロパティは失敗します。基本プロパティSIObject.Typeを調べれば、AnimationSourceItem
がコンパウンドであるかどうかが分かります。
' ' This example illustrates how to create a simple actionsource from some position animation. ' The AnimationSourceItem.Source property is used to get the fcurve source and modify the keys. ' NewScene , false set oRoot = Application.ActiveProject.ActiveScene.Root ' These commands were cut and pasted from scripting history ' and modified to work in a script. They create a simple ' actionsource from some animation on the null's position set oNull = GetPrim( "Null" ) strPosParams = oNull & ".kine.local.posx," & oNull & ".kine.local.posy," & oNull & ".kine.local.posz" Translate oNull, -8.153, 7.015, -0.702, siRelative, siView, siObj, siXYZ SaveKey strPosParams, 1.000 Translate oNull, 8.350, -8.935, 0.894, siRelative, siView, siObj, siXYZ SaveKey strPosParams, 50.000 Translate oNull, 9.413, 8.935, -0.894, siRelative, siView, siObj, siXYZ SaveKey strPosParams, 100.000 StoreAction oRoot, strPosParams, 2, "StoredFcvAction", True, 1, 100 ' Get the actionsource from the model set oActionSource = oRoot.Sources("StoredFcvAction") ' Find animation source item with posx for each oSourceItem in oActionSource.SourceItems if InStr(1,CStr(oSourceItem.Target),"posx",vbTextCompare)<>0 then exit for end if next ' Change the fcurve keys on the posx source set oFCurve = oSourceItem.Source oFCurve.SetKeys Array(1, -8, 50, 8, 100, 9 ) ' Apply actionsource with modified posx fcurve AddClip oRoot, oActionSource ' Now find the clip and test the source items set oClip = oRoot.Mixer.Clips(0) for each oAnimSrcItem in oClip.Source.SourceItems LogMessage oAnimSrcItem.FullName & " is active: " & oAnimSrcItem.Active next ' Output of above script: 'INFO : muting null.kine.local.posx 'INFO : AnimationSourceItem is active: False 'INFO : AnimationSourceItem is active: True 'INFO : AnimationSourceItem is active: True |